<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>Corn示例</title>
		<meta name="renderer" content="webkit" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<meta name="viewport"
			content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0" />
		<link rel="stylesheet" href="../static/layui/css/layui.css" media="all" />
		<style type="text/css">
			html{
				background-color: #f2f2f2;
				color: #666;
			}
			.layui-fluid{
				padding: 15px;
			}
		</style>
	</head>
	<body>
		<div class="layui-fluid">
			<div class="layui-row layui-col-space15">
				<div class="layui-col-md12">
					<div class="layui-card">
						<div class="layui-card-header">Cron组件</div>
						<div class="layui-card-body">
							<div id="cronStaticDiv"></div>
							<input type="text" class="layui-input" id="cronVal" value="0 0 0 1,3,5 * ?" />
						</div>
					</div>
				</div>
				<div class="layui-col-md12">
					<div class="layui-card">
						<div class="layui-card-header">测试弹窗（为了体验好，弹层宽高要大于 502 x 404）</div>
						<div class="layui-card-body">
							<div class="layui-btn-group">
								<button class="layui-btn" data-type='test1' type="button">小弹窗</button>
								<button class="layui-btn" data-type='test2' type="button">大弹窗</button>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>

		<script src="../static/layui/layui.js?t=1"></script>
		<script>
			layui
				.config({
					base: "../static/layui_exts/"
				})
				.extend({
					cron: "cron/cron",
				})
				.use(["cron"], function() {
					var $ = layui.$,
						cron = layui.cron;
					cron.render({
						elem: "#cronVal", // 绑定元素
						run: "../static/json/run.json", // 获取最近运行时间的接口
						lang:'cn',
						btns:['confirm'], // 只显示确认按钮
						done: function(cronStr) {
							console.log(cronStr);
						}
					});

					var active = {
						test1: function() {
							layer.open({
								type: 2,
								title:'小弹窗',
								content: './demoLayer.html',
								area: ['400px', '300px'],
								shadeClose:true
							});
						},
						test2: function() {
							layer.open({
								type: 2,
								title:'大弹窗',
								content: './demoLayer.html',
								area: ['900px', '600px'],
								shadeClose:true
							});
						}
					}

					$('.layui-btn-group .layui-btn').on('click', function() {
						var type = $(this).data('type');
						active[type] && active[type].call(this);
					});


				});
		</script>
	</body>
</html>
